﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

using AlphaForm;


namespace SlidingPanes
{
  public partial class SlideOut : Form
  {
    public SlideOut()
    {
      InitializeComponent();
    }

    public new virtual bool Visible
    {
      get
      {
        return base.Visible;
      }
      
      set  
      {
        // This will set this form's Visible property as well
        // as the attached alpha (layered) window which hosts the window
        // frame.
        alphaFormTransformer1.SetAlphaAndParentFormVisible(value);
      }
    }

    protected override void OnClosing(CancelEventArgs e)
    {
      alphaFormTransformer1.Fade(FadeType.FadeOut, true, false, 100);
      Form own = Owner;
      if (Owner != null)
        {
        Owner = null;
        own.Close();
        }
      base.OnClosing(e);
    }

    private void alphaFormMarker1_Load(object sender, EventArgs e)
    {
      alphaFormTransformer1.TransformForm(255);
    }

    private void button1_Click(object sender, EventArgs e)
    {
      if (Owner != null)
        (Owner as Form1).DrawerButton_Click(this, EventArgs.Empty);
    }
  }
}
